Internal combustion engines and reciprocating pumps have a piston that reciprocates in a cylinder. The piston has a rod that engages a crankshaft. The crankshaft is offset from the main drive axis to translate the linear motion of the piston and rotation of the shaft. Typically, the length of the stroke is fixed for a given crankshaft.
Changing the length of the stroke will change the compression ratio of an engine, but this normally requires replacing the crankshaft. Driving conditions may make it more efficient to have a higher compression ratio under certain conditions and a lower compression ratio under other conditions. It also might be advantageous to have a different stroke length for an exhaust stroke than for a compression stroke.
There are various proposals shown in patents that propose varying the piston stroke lengths. For various reasons, crankshaft assemblies of this nature are not commercially used at this time.